fix(recipe): check the API's size limits in the form; focus any invalid row #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
MAX_INGREDIENTS(100),MAX_INSTRUCTIONS(100),MAX_TAGS(30) andMAX_TAG_LENGTH(50) now live in@t31/validation/recipe, next to the servings limits. The API's Zod schema and the recipe form both use them, so the two can't disagree.parseTags(): trimmed, lower-case, empty entries and repeats removed. It counts and sends exactly what the API stores. Before, "Quick, quick" was sent as two tags, and the API checksmax(30)before it removes repeats.id.aria-describedby.[aria-invalid="true"], or a row-count message). Before, a fixed list only knew the first ingredient and step, so an error in row 2 or later sent focus back to the title.Validation
npm run checkpasses (277 unit tests). New tests:parseTags()vi.mock(inRecipeCreatePage.limits.test.tsx). Rendering 2×100 rows took about 4 s in jsdom, close to the 5 s test limit on CI.test:apipasses (the API schema now reads the shared constants).AI usage
Written with Claude Code (Anthropic) to address a teammate's issue. Please review the diff as you would any other contribution.
Closes #120